package com.ebupt.migu.music.common.util;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

public class FuncUtil {

    private FuncUtil() {
    }

    public static boolean isNull(Object obj) {
        return obj == null;
    }

    public static boolean isNotNull(Object obj) {
        return!isNull(obj);
    }

    public static boolean isEmpty(String str) {
        return str == null || str.trim().isEmpty();
    }

    public static boolean isEmpty(Object o) {
        return o == null ;
    }


    public static boolean isNotEmpty(String str) {
        return!isEmpty(str);
    }

    public static boolean isEmpty(Collection<?> collection) {
        return collection == null || collection.isEmpty();
    }

    public static boolean isNotEmpty(Collection<?> collection) {
        return!isEmpty(collection);
    }

    public static boolean isEmpty(Map<?,?> map) {
        return map == null || map.isEmpty();
    }

    public static boolean isNotEmpty(Map<?,?> map) {
        return!isEmpty(map);
    }

    public static boolean isEmpty(Optional<?> optional) {
        return optional == null ||!optional.isPresent();
    }

    public static boolean isNotEmpty(Optional<?> optional) {
        return!isEmpty(optional);
    }

    public static boolean isEmpty(BigDecimal bigDecimal) {
        return bigDecimal == null || bigDecimal.compareTo(BigDecimal.ZERO) == 0;
    }

    public static boolean isNotEmpty(BigDecimal bigDecimal) {
        return!isEmpty(bigDecimal);
    }

    public static boolean isEmpty(BigInteger bigInteger) {
        return bigInteger == null || bigInteger.equals(BigInteger.ZERO);
    }

    public static boolean isNotEmpty(BigInteger bigInteger) {
        return!isEmpty(bigInteger);
    }

    public static boolean isEmpty(Object[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isNotEmpty(Object[] array) {
        return!isEmpty(array);
    }

    public static boolean isEmpty(byte[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isNotEmpty(byte[] array) {
        return!isEmpty(array);
    }

    public static boolean isEmpty(short[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isNotEmpty(short[] array) {
        return!isEmpty(array);
    }

    public static boolean isEmpty(int[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isNotEmpty(int[] array) {
        return!isEmpty(array);
    }

    public static boolean isEmpty(long[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isNotEmpty(long[] array) {
        return!isEmpty(array);
    }

    public static boolean isEmpty(float[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isNotEmpty(float[] array) {
        return!isEmpty(array);
    }

    public static boolean isEmpty(double[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isNotEmpty(double[] array) {
        return!isEmpty(array);
    }

    public static boolean isEmpty(char[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isNotEmpty(char[] array) {
        return!isEmpty(array);
    }

    public static boolean isEmpty(Boolean value) {
        return value == null ||!value;
    }

    public static boolean isNotEmpty(Boolean value) {
        return!isEmpty(value);
    }

    public static boolean isAllNull(Object... objects) {
        for (Object obj : objects) {
            if (isNotNull(obj)) {
                return false;
            }
        }
        return true;
    }

    public static boolean isAnyNull(Object... objects) {
        for (Object obj : objects) {
            if (isNull(obj)) {
                return true;
            }
        }
        return false;
    }

    public static boolean deepEquals(Object o1, Object o2) {
        return Objects.deepEquals(o1, o2);
    }
}